Use ODBC to retrieve and import data stored in DB

 

Use ODBC to change the contents of the DB:

 

Examples of the screen configuration are as follows.

 

 

When the above screen appears on the localmain screen, the first record of the DB is retrieved and the next record is shown on the screen when you click

If the user clicks after modifying the values of the record shown on the screen, the data stored in the DB is updated to the currently changed value.

 

1)       In the 'At Program Start...' of Editor|File|Script, write the script as follows.

 

 

$UPDATEID = @SQLConnect("autobase","","");

@SQLSelect($UPDATEID, "table1", "bindlist", "","");

@SQLFirst($UPDATEID);

 

If you write the program as above, the screen above will show the first record of Table 1 of the DB.

 

2)      Click the button to show the contents of the first record of the current record on the screen.

 

@SQLFirst($UPDATEID);

 

3)      Click the button to show the contents of the last record of the current record on the screen.

 

@SQLLast($UPDATEID);

 

1)       Click the button to show the contents of the previous record of the current record on the screen.

 

@SQLPrev($UPDATEID);

 

2)       Click the button to show the contents of the next record of the current record on the screen.

 

@SQLNext($UPDATEID);

 

3)       If you modify the value of the record shown on the current screen and click the button , the data in the DB is changed to the current modified value.

 

$UPDATEPOS=@SQLGetPos($UPDATEID); // Store the location of the record of the data you are currently trying to modify in $UPDATEPOS.

 

@sprintf(buf,"YMD='%s'",$YMD); // If DB Field YMD is text, it should be tied to ''.

@SQLUpdate($UPDATEID, "Table1","bindlist",buf);  // The value of the data that fits the conditions stored in the buf above will be modified.

@SQLSelect($UPDATEID,"Table1","bindlist","","");  //  After modifying it, you need to load the data of the DB again to see the modified contents.

@SQLSetPos($UPDATEID,$UPDATEPOS);  // Read the updated value of the record in the modified position.